﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace InterfaceDefaultFunctionsImpl
{
    /// <summary>
    /// 扩展ITest接口，
    /// 相当于给ITest添加了两个默认方法：
    /// DefaultFunctionAdd
    /// DefaultFunctionSub
    /// </summary>
    public static class TestEx
    {
        /// <summary>
        /// 扩展方法1
        /// </summary>
        /// <param name="it"></param>
        /// <param name="a"></param>
        /// <param name="b"></param>
        /// <returns></returns>
        public static int DefaultFunctionAdd(this ITest it, int a, int b)
        {
            return a + b;
        }

        /// <summary>
        /// 扩展方法2
        /// </summary>
        /// <param name="it"></param>
        /// <param name="a"></param>
        /// <param name="b"></param>
        /// <returns></returns>
        public static int DefaultFunctionSub(this ITest it, int a, int b)
        {
            return a - b;
        }
    }
}
